home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
MATHS
/
RLAB
/
RLAB125.ZIP
/
!RLaB
/
rlib
/
fix
< prev
next >
Wrap
Text File
|
1994-02-21
|
646b
|
25 lines
//-------------------------------------------------------------------//
// Syntax: fix ( X )
// Description:
// Fix rounds the elements of X to the nearest integer towards zero.
// See Also ceil, floor, round, sign, abs
//-------------------------------------------------------------------//
fix = function ( X )
{
if (X.type == "real")
{
return sign (X) .* floor (abs (X));
else if (X.type == "complex") {
return (sign (real (X)) .* floor (abs (real (X)))) + ...
((0+1j)*(sign (imag (X))) .* floor (abs (imag (X))));
else
error("fix() only takes real or complex (scalar and matrix) arguments");
}}
};